import { GetUserModuleAsync } from '@/services/userModule';
const UserModuleModel = {
    namespace: 'UserModule',
    state: {
        current: {},
        response:{},
    },
    effects: {
        * setCurrent({ payload }, { put }) {
            yield put({
                type: 'set',
                payload,
            });
        },
        * getUserModule({ payload }, { call, put }) {
            const response = yield call(GetUserModuleAsync, payload);
            yield put({
                type: 'deal',
                payload: response,
            });
        },
    },
    reducers: {
        set(state, action) {
            return { ...state, current: action.payload };
        },
        deal(state, action) {
            return { ...state, response: action.payload };
        },
    },
};
export default UserModuleModel;